﻿@{
    ViewBag.Title = "系统配置管理";
    Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml";
}
<div class="fly-panel fly-panel-user" pad20="">
    <div class="layui-tab layui-tab-brief" lay-filter="user">
        <ul class="layui-tab-title">
            <li class="layui-this"><a href="/Admin/SysConfig/">系统配置管理</a></li>
        </ul>
        <div class="layui-form layui-tab-content" id="LAY_ucm" style="padding: 5px 0;">
            <div class="layui-tab-item layui-show">
                <form action="" class="layui-form">
                    <div class="layui-form-item" style="margin: 10px 0 0;">
                        <label class="layui-form-label" style="width: auto; padding-right: 5px;">关键字：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="keyword" class="layui-input" value="@ViewBag.Keyword">
                        </div>
                        <button type="submit" class="layui-btn">搜索</button>
                    </div>
                </form>

                <table class="layui-table" lay-data="{url:'/Admin/SysConfig/GetData?keyword=@ViewBag.Keyword', page: true,limit:20}" lay-filter="sysConfigList">
                    <thead>
                        <tr>
                            <th lay-data="{field:'ID',width:70}">ID</th>
                            <th lay-data="{field:'Name'}">名称</th>
                            <th lay-data="{field:'Key'}">Key</th>                            
                            <th lay-data="{fixed: 'right', width:80, align:'center', toolbar: '#barDemo'}">#</th>
                        </tr>
                    </thead>
                </table>

                <script type="text/html" id="barDemo">
                    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="edit" lay-data="{{d.Key}}">编辑</a>
                </script>

            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
  
    layui.use(['table', 'layer'], function () {
        var table = layui.table;
        //监听单元格事件
        table.on('tool(sysConfigList)', function (obj) {
            var data = obj.data;
            if (obj.event === 'edit') {
                url = "/Admin/SysConfig/Set" + data.Key;
                layer.open({
                    type: 2,
                    title: data.Name,
                    shadeClose: true,
                    shade: 0.8,
                    area: ['1000px', '90%'],
                    content: url
                });
                return;
            }             
        });
    });
</script>


